#pragma once
#include <string>

const int defulvalue = 0;
const std::string opers = "+-*/%";

enum
{
    right = 0,
    div_zore,
    mod_zore,
    unkonw
};

class Task
{
public:
    Task()
    {
    }

    Task(int x, int y, char op)
        : _x(x), _y(y), _oper(op), _result(0), _code(0)
    {
    }

    void Run()
    {
        switch (_oper)
        {
        case '+':
            _result = _x + _y;
            break;
        case '-':
            _result = _x - _y;
            break;
        case '*':
            _result = _x * _y;
            break;
        case '/':
        {
            if (_y == 0)
                _code = div_zore;
            else
                _result = _x / _y;
        }
        break;
        case '%':
        {
            if (_y == 0)
                _code = mod_zore;
            else
                _result = _x % _y;
        }
        break;
        default:
            _code = unkonw;
            break;
        }
    }

    void operator()()
    {
        Run();
    }

    std::string PrintTask()
    {
        std::string s;
        s = std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += "=?";

        return s;
    }

    std::string PrintResult()
    {
        std::string s;
        s = std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += "=";
        s += std::to_string(_result);
        s += " [";
        s += std::to_string(_code);
        s += "]";

        return s;
    }

    ~Task()
    {
    }

private:
    int _x;
    int _y;
    char _oper;

    int _result;
    int _code;
};